<div class="admin">
    <div class="tab panel dux-box admin-panel">
        <div class="panel-head"><strong>页面导航</strong></div>
        <div class="padding border-bottom">
            <a href="{:U('index')}" class="button button-small border-green">管理</a>
            <a href="JavaScript:void(0);" class="button button-small border-green">新增</a>
        </div>
        <div class="fixed-empty"></div>
        <form id="myform" name="myform" method="post" action="{:U('edit',array('nav_id'=>$res['nav_id']))}">
            <table class="table tb-type2">
                <tbody>
                    <tr>
                        <td width="10%" class="required"><label class="validation" for="gc_name">导航类型:</label></td>
                        <td width="30%" class="vatop rowform">
                            <ul class="nofloat">
                                <li class="left w100pre"><span class="radio">
                                        <input type="radio" value="0" name="nav_type" id="diy" onclick="showType('diy');"{$item_id[0]}>
                                        <label for="diy">自定义导航</label>
                                    </span></li>
                                <li class="left w100pre"><span class="radio">
                                        <input type="radio" value="1" name="nav_type" id="goods_class" onclick="showType('goods_class');"{$item_id[1]}>
                                        <label for="goods_class">商品分类</label>
                                    </span>
                                    <select name="goods_class_id" id="goods_class_id" {$res['nav_type'] == '1' ? 'text' : "style='display: none;'"}>
                                            <foreach name="arr" item="v">
                                            <option value="{$v['gc_id']}" {$res['item_id'] == $v['gc_id'] ? "selected='selected'" : 'text'}>{$v['gc_name']}</option>
                                            <foreach name="v['_data']" item="v1">
                                                <option value="{$v1['gc_id']}" {$res['item_id'] == $v1['gc_id'] ? "selected='selected'" : 'text'}>└─{$v1['gc_name']}</option>
                                                <foreach name="v1['_data']" item="v2">
                                                    <option value="{$v2['gc_id']}" {$res['item_id'] == $v2['gc_id'] ? "selected='selected'" : 'text'}>&nbsp;&nbsp;&nbsp;├─{$v2['gc_name']}</option>
                                                </foreach>
                                            </foreach>
                                        </foreach>
                                    </select>
                                </li>
                                <li class="left w100pre"><span class="radio">
                                        <input type="radio" value="2" name="nav_type" id="article_class" onclick="showType('article_class');"{$item_id[2]}>
                                        <label for="article_class">文章分类</label>
                                    </span>
                                    <select name="article_class_id" id="article_class_id" {$res['nav_type'] == '2' ? 'text' : "style='display: none;'"}>
                                            <foreach name="array" item="v">
                                            <option value="{$v['cat_id']}" {$res['item_id'] == $v['cat_id'] ? "selected='selected'" : 'text'}>{$v['cat_name']}</option>
                                            <foreach name="v['_data']" item="v1">
                                                <option value="{$v1['cat_id']}" {$res['item_id'] == $v1['cat_id'] ? "selected='selected'" : 'text'}>└─{$v1['cat_name']}</option>
                                                <foreach name="v1['_data']" item="v2">
                                                    <option value="{$v2['cat_id']}" {$res['item_id'] == $v2['cat_id'] ? "selected='selected'" : 'text'}>&nbsp;&nbsp;&nbsp;├─{$v2['cat_name']}</option>
                                                </foreach>
                                            </foreach>
                                        </foreach>
                                    </select>
                                </li>
                                <li class="left w100pre"><span class="radio">
                                        <input type="radio" value="3" name="nav_type" id="activity" onclick="showType('activity');"{$item_id[3]}>
                                        <label for="activity">活动</label>
                                    </span>
                                    <select name="activity_id" id="activity_id" {$res['nav_type'] == '3' ? 'text' : "style='display: none;'"}>
                                </select>
                            </li>
                        </ul>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr>
                    <td class="required"><label class="validation" for="nav_title">标题:</label></td>
                    <td class="vatop rowform"><input type="text" class="form-control" value="{$res['nav_title']}" name="nav_title" size="60" /></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr>
                    <td class="required"><label class="validation" for="nav_url">链接:</label></td>
                    <td class="vatop rowform"><textarea class="form-control" name="nav_url" id="nav_url" cols="62" rows="3">{$res['nav_url']}</textarea></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr>
                    <td class="required"><label class="validation" for="nav_location">所在位置:</label></td>
                    <td class="vatop rowform">
                        <div class="form-group">
                            <div class="field">
                                <div class="button-group radio">
                                    <label class="button active">
                                        <input name="nav_location" value="0" type="radio" {$nav_location[0]}><span class="icon icon-check"></span> 头部
                                    </label>
                                    <label class="button">
                                        <input name="nav_location" value="1" type="radio" {$nav_location[1]}><span class="icon icon-check"></span> 中部
                                    </label>
                                    <label class="button">
                                        <input name="nav_location" value="2" type="radio" {$nav_location[2]}><span class="icon icon-check"></span> 底部
                                    </label>
                                    <label class="button">
                                        <input name="nav_location" value="3" type="radio" {$nav_location[3]}><span class="icon icon-check"></span> 手机头部
                                    </label>
                                    <label class="button">
                                        <input name="nav_location" value="4" type="radio" {$nav_location[4]}><span class="icon icon-check"></span> 手机底部
                                    </label>											
                                </div>
                            </div>
                        </div>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr>
                    <td class="required"><label class="validation" for="nav_new_open">新窗口打开:</label></td>
                    <td class="vatop rowform onoff">
                        <div class="form-group">
                            <div class="field">
                                <div class="button-group radio">
                                    <label class="button active">
                                        <input name="nav_new_open" value="1" checked="checked" type="radio"><span class="icon icon-check"></span> 是
                                    </label>
                                    <label class="button">
                                        <input name="nav_new_open" value="0" type="radio"><span class="icon icon-times"></span> 否
                                    </label>
                                </div>
                            </div>
                        </div>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr>
                    <td class="required"><label class="validation" for="nav_sort">排序:</label></td>
                    <td class="vatop rowform"><input type="text" class="form-control" name="nav_sort" size="10" value="{$res['nav_sort']}" /></td>
                    <td class="vatop tips"></td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="3"><input class="button bg-main" type="submit" value="提交"></td>
                </tr>
            </tfoot>
        </table>
    </form>
</div>
<script type="text/javascript">
    $('#myform').layer({});

    function showType(type) {
        $('#goods_class_id').css('display', 'none');
        $('#article_class_id').css('display', 'none');
        $('#activity_id').css('display', 'none');
        if (type == 'diy') {
            $('#nav_url').attr('disabled', false);
        } else {
            $('#nav_url').attr('disabled', true);
            $('#' + type + '_id').show();
        }
    }
</script>
</body>
</html>
